package tw.com.softleader.reins.demo.city.app;

import tw.com.softleader.reins.demo.city.entity.City;
import tw.com.softleader.reins.demo.city.service.CityService;

public class CityApp {

	public static void main(String[] args) {
		CityService cityservice = new CityService();
		
		System.out.println("----------------------getAll---------------------");
		System.out.printf("%-20s%-15s%-15s%n"," Name", " Population", " Area");
		System.out.println("-------------------------------------------------");
		
		for(City citys:cityservice.getAll()){
			System.out.printf(" %-20s%-15s%-15s%n",citys.getName(),citys.getPopulation(),citys.getArea()+"平方公里");	
		}
		
		System.out.println("--------------------getByName--------------------");
		System.out.printf("%-20s%-15s%-15s%n"," Name", " Population", " Area");
		System.out.println("-------------------------------------------------");
		
		City city = cityservice.getByName("Taipei");
		System.out.printf(" %-20s%-15s%-15s%n",city.getName(),city.getPopulation(),city.getArea()+"平方公里");
	}

}
